
    //Scroll to top
	$(document).ready(function(){
	
		// hide #back-top first
		$("#back-top").hide();
		
		// fade in #back-top
		$(function () {
			$(window).scroll(function () {
				if ($(this).scrollTop() > 100) {
					$('#back-top').fadeIn();
				} else {
					$('#back-top').fadeOut();
				}
			});
	
			// scroll body to 0px on click
			$('#back-top a').click(function () {
				$('body,html').animate({
					scrollTop: 0
				}, 800);
				return false;
			});
		});
	
	});
	
	
	//Twitter
	jQuery(function($){
		$(".tweet").tweet({
				username: "envatowebdesign",
				join_text: "auto",
				avatar_size: 32,
				count:2,
		});});
		
	//Flickr
	$(document).ready(function(){

		$('#basicuse').jflickrfeed({
			limit: 9,
			qstrings: {
				id: '36587311@N08'
			},
			itemTemplate: '<li><a href="{{image_b}}" class="fancybox-effects-b"><img src="{{image_s}}" alt="{{title}}" /></a></li>'
		});
		
	});
	
	//Ticker
	
    //Tab script
     $(document).ready(function() {
		$('#myTab a:first').tab('show');
		 //news ticker
		$('#js-news').ticker({
			titleText: '',
			prevID: true,
			nextID: true,
			controls: true,
        }); 
	});
	
	// Top Menu
	$(document).ready(function() {	$("#responsive_menu li").click(function() {
			$(this).toggleClass('active');
			$(".responsive-menu-items").slideToggle("fast");
			$('.fullScreenSlideshowNav').toggle();
			$('.supersizecaption').toggle();
		});

		$(".responsive-menu-items").html("<ul class='resp-menu'></ul>");

		$('.menu-main #main-menu > li').each(function(index) {
			var thisli = $(this).clone();
			$(".resp-menu").append(thisli);
			$('.responsive-menu-items li').find('span').remove();
		});
		$('.resp-menu .sub-menu li .sub-menu a').each(function(index) {
			var nowtext = $(this).text();
			var newtext = "- " + nowtext;
			$(this).text(newtext);
		});
		$('.menu').superfish();
	});


	//Fancybox
	
         $(document).ready(function() {
         $(".fancybox-thumb").fancybox({
         	prevEffect	: 'none',
         	nextEffect	: 'none',
         	helpers	: {
         		title	: {
         			type: 'outside'
         		},
         		thumbs	: {
         			width	: 50,
         			height	: 50
         		}
         	}
         });
         });
         //fancybox media
         $('.fancybox-media')
         .attr('rel', 'media-gallery')
         .fancybox({
         openEffect : 'none',
         closeEffect : 'none',
         prevEffect : 'none',
         nextEffect : 'none',
         
         arrows : false,
         helpers : {
         	media : {},
         	buttons : {}
         }
         });
         
         /*
         *  Different effects
         */
         
         // Change title type, overlay closing speed
         $(".fancybox-effects-a").fancybox({
         helpers: {
         title : {
         	type : 'outside'
         },
         overlay : {
         	speedOut : 0
         }
         }
         });
         
         // Disable opening and closing animations, change title type
         $(".fancybox-effects-b").fancybox({
         openEffect  : 'none',
         closeEffect	: 'none',
         
         helpers : {
         title : {
         	type : 'over'
         }
         }
         });
         
         // Set custom style, close if clicked, change title type and overlay color
         $(".fancybox-effects-c").fancybox({
         wrapCSS    : 'fancybox-custom',
         closeClick : true,
         
         openEffect : 'none',
         
         helpers : {
         title : {
         	type : 'inside'
         },
         overlay : {
         	css : {
         		'background' : 'rgba(238,238,238,0.85)'
         	}
         }
         }
         });
         
         // Remove padding, set opening and closing animations, close if clicked and disable overlay
         $(".fancybox-effects-d").fancybox({
         padding: 0,
         
         openEffect : 'elastic',
         openSpeed  : 150,
         
         closeEffect : 'elastic',
         closeSpeed  : 150,
         
         closeClick : true,
         
         helpers : {
         overlay : null
         }
         });
         
         /**/
         $('.fancybox').fancybox();	